package com.psycho.sys.api.mapper;

import java.time.LocalDateTime;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.psycho.sys.api.entity.Appointment;
import com.psycho.sys.api.vo.AppointmentVO;

/**
 * 预约Mapper接口
 */
@Mapper
public interface AppointmentMapper extends BaseMapper<Appointment> {
        /**
         * 查询预约列表（包含咨询师和用户信息）
         * 当page参数为null时返回List，否则返回分页结果
         */
        Page<AppointmentVO> selectAppointmentWithDetails(Page<AppointmentVO> page,
                        @Param("userId") Long userId,
                        @Param("counselorId") Long counselorId,
                        @Param("status") Integer status);

        /**
         * 检查时间段是否可预约
         */
        Integer checkTimeSlotAvailable(@Param("counselorId") Long counselorId,
                        @Param("startTime") LocalDateTime startTime,
                        @Param("endTime") LocalDateTime endTime);
}